﻿package mortal.common.preLoadPage
{
    import Message.Login.*;
    import com.gengine.global.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.view.common.*;
    import mortal.mvc.interfaces.*;

    public class SelectRoleAlertTipWindow extends SmallWindow
    {
        protected var _tips:GTextFiled;
        protected var _btnOK:GButton;
        protected var _btnCancel:GButton;
        protected var _callBack:Function;
        private static var _instance:SelectRoleAlertTipWindow;

        public function SelectRoleAlertTipWindow(param1:ILayer = null)
        {
            super(param1);
            setSize(310, 205);
            return;
        }// end function

        public function updateTipRole(param1:SMyRole) : void
        {
            var _loc_2:* = PreLanguage.getStringByParam(157, param1.level.toString(), param1.name, param1.oldServerId.toString());
            _loc_2 = _loc_2 + PreLanguage.getString(114);
            this._tips.htmlText = _loc_2;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = PreLanguage.getString(114);
            this._tips = UIFactory.gTextField("", 20, 40, 280, 125, this, GlobalStyle.textFormatBai);
            this._tips.multiline = true;
            this._tips.wordWrap = true;
            this._tips.htmlText = _loc_1;
            this._btnOK = UIFactory.gButton(PreLanguage.getString(158), 80, 165, 50, 22, this);
            this._btnCancel = UIFactory.gButton(PreLanguage.getString(159), 180, 165, 50, 22, this);
            this._btnOK.drawNow();
            this._btnCancel.drawNow();
            this._btnOK.configEventListener(MouseEvent.CLICK, this.onClickBtnOK);
            this._btnCancel.configEventListener(MouseEvent.CLICK, this.onClickBtnCancel);
            return;
        }// end function

        protected function onClickBtnOK(event:MouseEvent) : void
        {
            if (this._callBack != null)
            {
                this._callBack.call();
            }
            this.hide();
            return;
        }// end function

        protected function onClickBtnCancel(event:MouseEvent) : void
        {
            this.hide();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._tips.dispose();
            this._tips = null;
            this._callBack = null;
            this._btnOK.dispose();
            this._btnOK = null;
            this._btnCancel.dispose();
            this._btnCancel = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            this.x = (Global.stage.stageWidth - 310) / 2 + 10;
            this.y = (Global.stage.stageHeight - 205) / 2;
            Global.stage.addChild(this);
            return;
        }// end function

        override public function hide() : void
        {
            if (Global.stage.contains(this))
            {
                Global.stage.removeChild(this);
            }
            return;
        }// end function

        override protected function onWindowDownHandler(event:MouseEvent) : void
        {
            return;
        }// end function

        public function setCloseCall(param1:Function) : void
        {
            this._callBack = param1;
            return;
        }// end function

        public static function get instance() : SelectRoleAlertTipWindow
        {
            if (!_instance)
            {
                _instance = new SelectRoleAlertTipWindow;
            }
            return _instance;
        }// end function

    }
}
